<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>数据查看</title>
    <%@include file="../include/commonFile.jsp" %>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">

</head><body>
<%@include file="../include/header.jsp" %>

<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <section>
        <div class="section-main">
            <%--众筹主题-->联合发起--%>
            <div class="layui-tab layui-tab-brief mt20">
                <ul class="layui-tab-title">
                    <c:choose>
                        <c:when test="${isMultiple == true}">
                            <li >众筹<span class="pl5">${projectNum}</span>人</li>
                            <li class="layui-this">联合发起<span class="pl5">${page.totalCount}</span>人</li>
                        </c:when>
                        <c:otherwise>
                            <li class="" id="funding">众筹<span id="total_1" class="pl5">${projectNum}</span>人</li>
                            <li class="layui-this" id="representing">联合发起<span id="total_0" class="pl5">${representNun}</span>人</li>
                            <li class="" id="directPay">直接付款<span id="total_2" class="pl5">${directNun}</span>人</li>
                        </c:otherwise>
                    </c:choose>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item  layui-show">
                        <form class="layui-form"
                              action="${ctx}/crowdfund/represen/listForEvent.do?eventId=${withCount.eventId}"
                              id="myForm" method="post">
                            <input type="hidden" name="pageNo" id="pageNo"/>
                            <div class="f-search-bar">
                                <div class="search-container">
                                    <ul class="search-form-content">
                                        <li class="form-item-inline"><label class="search-form-lable">姓名：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="authorName" autocomplete="off"
                                                       class="layui-input" value="${withCount.authorName}"
                                                       placeholder="姓名"
                                                >
                                            </div>
                                        </li>
                                        <li class="form-item-inline"><label class="search-form-lable">联系电话：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="authorMobile" autocomplete="off"
                                                       class="layui-input" value="${withCount.authorMobile}"
                                                       placeholder="联系电话"
                                                >
                                            </div>
                                        </li>
                                        <li class="form-item-inline">
                                            <div class="sub-btns">
                                                <a class="layui-btn layui-btn-danger"
                                                   href="javascript:submitFunction('#myForm')">查询</a>
                                                <a class="layui-btn layui-btn-normal"
                                                   href="javascript:resetFunction('#myForm')">重置</a>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </form>
                        <form class="layui-form" action="${ctx}/crowdfund/represen/representListForEventExport.do"
                              id="exportForm" method="post">
                            <input type="hidden" name="eventId" value="${withCount.eventId}">
                        </form>
                        <div class="my-act-list-content">
                            <ul class="num">
                                <div class="l">
                                    <li class="f16">联合发起<span class="red">${page.totalCount}</span>人</li>
                                </div>
                                <div class="r">
                                    <li style="cursor: pointer;" class="r">
                                        <a class="layui-btn layui-btn-danger layui-btn-sm" id="btnExport">导出EXCEL</a>
                                    </li>
                                </div>
                                <p class="cl"></p>
                            </ul>
                            <div class="cl">
                                <table class="layui-table">
                                    <colgroup>
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                        <col width="10%">
                                    </colgroup>
                                    <thead>
                                    <tr>
                                        <th>姓名</th>
                                        <th>公司</th>
                                        <th>区域</th>
                                        <th>职务</th>
                                        <th>联系电话</th>
                                        <th>众筹人数</th>
                                        <th>支持人数</th>
                                        <th>支持金额</th>
                                        <th>浏览量</th>
                                        <th>分享量</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach var="directPay" items="${list}">
                                        <tr>
                                            <td class="table-member"
                                                onclick="openDialogShow('用户名片','${ctx}/system/member/memberView.do?id=${directPay.distributorId}','400px','470px')">
                                                <div class="member-cell">
                                                    <div class="member-logo common-img">
                                                        <img src="<c:if test="${ directPay.authorLogo!= null}">${directPay.authorLogo}?imageMogr2/auto-orient/crop/126x126</c:if>" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                                    </div>
                                                    <div class="member-name ellipsis-1"><a class="blue"
                                                                                           title="${directPay.authorName}"
                                                                                           href="javascript:void(0);">${directPay.authorName}</a>
                                                    </div>
                                                </div>
                                            </td>
                                            <td>
                                                <div class="ellipsis-1"
                                                     title="${directPay.authorCompany}">${directPay.authorCompany}</div>
                                            </td>
                                            <td>
                                                    ${directPay.cityName}
                                            </td>
                                            <td>
                                                    ${directPay.authorJobTitle}
                                            </td>
                                            <td>
                                                    ${directPay.authorMobile}
                                            </td>
                                            <td>
                                                <a href="javascript:void(0);" class="blue ${directPay.crowdfundNum > 0 ? 'crowdfundNum' : ''} count-num"
                                                   data-id="${directPay.id}"
                                                   data-name="${directPay.authorName}">${directPay.crowdfundNum}</a>

                                            </td>
                                            <td>
                                                <a href="javascript:void(0);" class="blue ${directPay.actualAmount > 0 ? 'favorerNum' : ''} count-num"
                                                   data-id="${directPay.id}"
                                                   data-name="${directPay.authorName}">${directPay.favorerNum}</a>

                                            </td>
                                            <td>
                                                <a href="javascript:void(0);" class="blue ${directPay.actualAmount > 0 ? 'actualAmount' : ''} count-num"
                                                   data-id="${directPay.id}"
                                                   data-name="${directPay.authorName}"> ${directPay.actualAmount}</a>

                                            </td>
                                            <td>
                                                    ${directPay.viewNum}
                                            </td>
                                            <td>
                                                    ${directPay.shareNum}
                                            </td>
                                            <td>
                                                <c:if test="${empty directPay.crowdfundNum or directPay.crowdfundNum == 0}">
                                                    <a href="javascript:txz.deleteObject('确定要删除该联合发起众筹吗？', '${ctx}/crowdfund/project/deleteRepresent.do?id=${directPay.id}');"
                                                       target="_self">
                                                        删除
                                                    </a>
                                                </c:if>
                                            </td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div id="page_content" class="page-container"></div>
                    </div>
                    <div class="layui-tab-item">

                    </div>
                </div>
            </div>
        </div><%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">

    var laytpl = null;
    var laypage = null;
    var element = null;
    txz.initHeader({
        nav:[{
            name: '众筹主题管理',
            href: ${isMultiple} ? '${ctx}/crowdfundMultiple/event/list.do' : '${ctx}/crowdfund/event/list.do'
        },{
            name: '${crowdfundEvent.name}'
        },{
            name: '数据查看',
            curr: true
        }],
        btns:[{
            type:'back'
        }]
    });

    $(function () {

        //加载分页
        loadPageNew({elem: 'page_content', totalCount: '${page.totalCount}', limit: '${page.limit}', page: '${page.page}'});

        if (${isMultiple == true}) {
            $("#myForm").attr('action', '${ctx}/activityMultiple/represent/listForEvent.do?eventId=${crowdfundEvent.id}');
        }

        layui.use(['laytpl', 'laypage', 'element'], function () {
            laytpl = layui.laytpl;
            laypage = layui.laypage;
            element = layui.element;


            element.on('tab', function (data) {
                if (${isMultiple == true}) {
                    if (data.index == 0) {
                        window.location.href = "${ctx}/activityMultiple/project/listForEvent.do?eventId=${crowdfundEvent.id}";
                    } else if (data.index == 1) {
                        window.location.href = "${ctx}/activityMultiple/represent/listForEvent.do?eventId=${crowdfundEvent.id}";
                    }
                } else {
                    if (data.index == 0) {
                        window.location.href = "${ctx}/crowdfund/project/listForEvent.do?eventId=${withCount.eventId}";
                    } else if (data.index == 1) {
                        window.location.href = "${ctx}/crowdfund/represen/listForEvent.do?eventId=${withCount.eventId}";
                    } else if (data.index == 2) {
                        window.location.href = "${ctx}/crowdfund/project/dpListForEvent.do?eventId=${withCount.eventId}&payType=1";
                    }
                }
            });
        });
        $('.crowdfundNum').click(function () {
            var relationId = this.dataset.id;
            if (${isMultiple == true}) {
                window.location.href = '${ctx}/activityMultiple/project/event/listForDistributor.do?eventId=${withCount.eventId}&relationId='+relationId;
            } else {
                window.location.href = '${ctx}/crowdfund/project/event/listForDistributorId.do?eventId=${withCount.eventId}&relationId=' + relationId;
            }
        });


        $('.favorerNum').click(function () {
            var relationId = this.dataset.id;
            if (${isMultiple == true}) {
                window.location.href = '${ctx}/activityMultiple/support/event/listForDistributor.do?eventId=${withCount.eventId}&relationId='+relationId;
            } else {
                window.location.href = '${ctx}/crowdfund/support/event/listForDistributorId.do?eventId=${withCount.eventId}&relationId=' + relationId;
            }
        });

        $('.actualAmount').click(function () {
            var relationId = this.dataset.id;
            if (${isMultiple == true}) {
                window.location.href = '${ctx}/activityMultiple/support/event/listForDistributor.do?eventId=${withCount.eventId}&relationId='+relationId;
            } else {
                window.location.href = '${ctx}/crowdfund/support/event/listForDistributorId.do?eventId=${withCount.eventId}&relationId=' + relationId;
            }
        });

        $("#btnExport").click(function () {
            layer.confirm('确认要导出Excel吗?', {
                icon: 3,
                title: '系统提示'
            }, function (index) {
                var url = $("#exportForm").attr("action");
                var loadIndex = layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                $.post(url, $("#exportForm").serialize(), function (res) {
                    top.layer.close(loadIndex);
                    if (res.success) {
                        window.location.href = res.data;
                    } else {
                        util.layerMsgError(res.description)
                    }
                });
                top.layer.close(index);
            });
        });
    })

</script>
</body>
</html>
